import { v4 as uuidv4 } from "uuid";

export const setUUID = () => {
	// 先从LS中捞，再进行判断
	let user_uuid = localStorage.getItem("USER_UUID");

	// 如果LS中没有
	if (!user_uuid) {
		// 则生成uuid 并写入仓库
		user_uuid = uuidv4();
		localStorage.setItem("USER_UUID", user_uuid);
	}
	// 如果LS中有
	return user_uuid;
};
